package com.kaisheng.service;

import java.util.List;

import com.kaisheng.dao.IdeaCommentDao;
import com.kaisheng.entity.IdeaComment;
import com.kaisheng.util.DateUtil;
import com.kaisheng.util.PKUtil;

public class IdeaCommentService {

	IdeaCommentDao commentdao = new IdeaCommentDao();
	public void save(String ideaid, String userid, String comment) {
	
		IdeaComment ic = new IdeaComment();
		ic.setId(PKUtil.getId());
		ic.setContent(comment);
		ic.setCreatetime(DateUtil.getNowDateTime());
		ic.setIdea_id(ideaid);
		ic.setUser_id(userid);
		commentdao.saveNewComment(ic);
		
		
	}
	
	public List<IdeaComment> findAllComments(String ideaid) {
		
		return commentdao.findAllCommentsById(ideaid);
	}

	public void deleteComment(String commentid) {
		commentdao.deleteCommentById(commentid);
		
	}

	public IdeaComment findCommentContent(String commentid) {
		
		return commentdao.findCommentsById(commentid);
	}

	public void updateCommentContent(String editcontent, String commentid) {
		commentdao.updateById( editcontent,commentid);
		
	}


}
